﻿using System;
using System.Text;
using System.Drawing;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;

public static partial class glDRIVE
{
    /*
    不完全Beta函数
    a：a参数。要求a>0,否则返回函数值-1.0。
    b：b参数。要求b>0,否则返回函数值-1.0。
    x：x自变量。要求0=<x<=1，否则返回函数值1.0e+37。
    函数返回不完全Beta函数值。
    */

    public static string drive_inbeta()
    {
        int i, j;
        double x, a0, b0, y;
        double[] a = new double[5] { 0.5, 0.5, 1.0, 5.0, 8.0 };
        double[] b = new double[5] { 0.5, 5.0, 3.0, 0.5, 10.0 };
        x = 0.0;
        StringBuilder sb = new StringBuilder();
        for (j = 0; j <= 5; j++)
        {
            sb.AppendLine("x=" + x + "<br>");
            for (i = 0; i <= 4; i++)
            {
                a0 = a[i];
                b0 = b[i];
                y = gl.inbeta(a0, b0, x);
                sb.AppendLine("      B(" + a0 + ", " + b0 + ")=" + y + "<br>");
            }
            x = x + 0.2;
        }
        return sb.ToString();
    }
}